<?php echo $header; ?>
<div id="content">
<div class="breadcrumb">
  <?php foreach ($breadcrumbs as $breadcrumb) { ?>
  <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
  <?php } ?>
</div>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<div class="box">
  <div class="heading">
    <h1><img src="view/image/module.png" alt="" /> <?php echo $heading_title; ?></h1>
    <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a></div>
  </div>
  <div class="content">
    <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
      <table class="form">
        <tr>
          <td><?php echo $entry_theme; ?></td>
          <td><select name="nivo_slider_theme">
                <?php foreach ($themes as $theme) { ?>
                <?php if ($theme == $nivo_slider_theme) { ?>
                <option value="<?php echo $theme; ?>" selected="selected"><?php echo $theme; ?></option>
                <?php } else { ?>
                <option value="<?php echo $theme; ?>"><?php echo $theme; ?></option>
                <?php } ?>
                <?php } ?>
              </select></td>
        </tr>
		<tr>
          <td><?php echo $entry_featured; ?></td>
          <td><?php if ($nivo_slider_featured) { ?>
                <input type="radio" name="nivo_slider_featured" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_featured" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_featured" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_featured" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_effect; ?></td>
          <td><select name="nivo_slider_effect">
                <?php foreach ($effects as $effect) { ?>
                <?php if ($effect == $nivo_slider_effect) { ?>
                <option value="<?php echo $effect; ?>" selected="selected"><?php echo $effect; ?></option>
                <?php } else { ?>
                <option value="<?php echo $effect; ?>"><?php echo $effect; ?></option>
                <?php } ?>
                <?php } ?>
              </select></td>
        </tr>
		<tr>
          <td><?php echo $entry_slices; ?></td>
          <td><input type="text" name="nivo_slider_slices" value="<?php echo $nivo_slider_slices; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_box_cols; ?></td>
          <td><input type="text" name="nivo_slider_box_cols" value="<?php echo $nivo_slider_box_cols; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_box_rows; ?></td>
          <td><input type="text" name="nivo_slider_box_rows" value="<?php echo $nivo_slider_box_rows; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_anim_speed; ?></td>
          <td><input type="text" name="nivo_slider_anim_speed" value="<?php echo $nivo_slider_anim_speed; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_pause_time; ?></td>
          <td><input type="text" name="nivo_slider_pause_time" value="<?php echo $nivo_slider_pause_time; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_start_slide; ?></td>
          <td><input type="text" name="nivo_slider_start_slide" value="<?php echo $nivo_slider_start_slide; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_direction_nav; ?></td>
          <td><?php if ($nivo_slider_direction_nav) { ?>
                <input type="radio" name="nivo_slider_direction_nav" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_direction_nav" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_direction_nav" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_direction_nav" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_direction_nav_hide; ?></td>
          <td><?php if ($nivo_slider_direction_nav_hide) { ?>
                <input type="radio" name="nivo_slider_direction_nav_hide" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_direction_nav_hide" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_direction_nav_hide" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_direction_nav_hide" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_control_nav; ?></td>
          <td><?php if ($nivo_slider_control_nav) { ?>
                <input type="radio" name="nivo_slider_control_nav" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_control_nav" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_control_nav" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_control_nav" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_control_nav_thumbs; ?></td>
          <td><?php if ($nivo_slider_control_nav_thumbs) { ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_control_nav_thumbs_from_rel; ?></td>
          <td><?php if ($nivo_slider_control_nav_thumbs_from_rel) { ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs_from_rel" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs_from_rel" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs_from_rel" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_control_nav_thumbs_from_rel" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_control_nav_thumbs_search; ?></td>
          <td><input type="text" name="nivo_slider_control_nav_thumbs_search" value="<?php echo $nivo_slider_control_nav_thumbs_search; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_control_nav_thumbs_replace; ?></td>
          <td><input type="text" name="nivo_slider_control_nav_thumbs_replace" value="<?php echo $nivo_slider_control_nav_thumbs_replace; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_keyboard_nav; ?></td>
          <td><?php if ($nivo_slider_keyboard_nav) { ?>
                <input type="radio" name="nivo_slider_keyboard_nav" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_keyboard_nav" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_keyboard_nav" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_keyboard_nav" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_pause_on_hover; ?></td>
          <td><?php if ($nivo_slider_pause_on_hover) { ?>
                <input type="radio" name="nivo_slider_pause_on_hover" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_pause_on_hover" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_pause_on_hover" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_pause_on_hover" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_manual_advance; ?></td>
          <td><?php if ($nivo_slider_manual_advance) { ?>
                <input type="radio" name="nivo_slider_manual_advance" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_manual_advance" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_manual_advance" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_manual_advance" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
		<tr>
          <td><?php echo $entry_caption_opacity; ?></td>
          <td><input type="text" name="nivo_slider_caption_opacity" value="<?php echo $nivo_slider_caption_opacity; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_prev_text; ?></td>
          <td><input type="text" name="nivo_slider_prev_text" value="<?php echo $nivo_slider_prev_text; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_control_next_text; ?></td>
          <td><input type="text" name="nivo_slider_next_text" value="<?php echo $nivo_slider_next_text; ?>" /></td>
        </tr>
		<tr>
          <td><?php echo $entry_random_start; ?></td>
          <td><?php if ($nivo_slider_random_start) { ?>
                <input type="radio" name="nivo_slider_random_start" value="1" checked="checked" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_random_start" value="0" />
                <?php echo $text_no; ?>
                <?php } else { ?>
                <input type="radio" name="nivo_slider_random_start" value="1" />
                <?php echo $text_yes; ?>
                <input type="radio" name="nivo_slider_random_start" value="0" checked="checked" />
                <?php echo $text_no; ?>
                <?php } ?></td>
        </tr>
	   </table>	
	   <table class="list">	
		<tr>
			<td>Note: Images used in the slider for the Orman Theme should have the dimensions 568px x 268px</td>
		</tr>
		<tr>
			<td>Note: Images used in the slider for the Pascal Theme should have the dimensions 630px x 235px</td>
		</tr>
		<tr>
			<td>Note: Images used in the slider for the Nivo Theme should have the dimensions 960px x 408px</td>
		</tr>
      </table>
	  <table id="module" class="list">
        <thead>
          <tr>
            <td class="left"><?php echo $entry_banner; ?></td>
            <td class="left"><?php echo $entry_dimension; ?></td>
            <td class="left"><?php echo $entry_layout; ?></td>
            <td class="left"><?php echo $entry_position; ?></td>
            <td class="left"><?php echo $entry_status; ?></td>
            <td class="right"><?php echo $entry_sort_order; ?></td>
            <td></td>
          </tr>
        </thead>
        <?php $module_row = 0; ?>
        <?php foreach ($modules as $module) { ?>
        <tbody id="module-row<?php echo $module_row; ?>">
          <tr>
            <td class="left"><select name="nivo_slider_module[<?php echo $module_row; ?>][banner_id]">
                <?php foreach ($banners as $banner) { ?>
                <?php if ($banner['banner_id'] == $module['banner_id']) { ?>
                <option value="<?php echo $banner['banner_id']; ?>" selected="selected"><?php echo $banner['name']; ?></option>
                <?php } else { ?>
                <option value="<?php echo $banner['banner_id']; ?>"><?php echo $banner['name']; ?></option>
                <?php } ?>
                <?php } ?>
              </select></td>
            <td class="left"><input type="text" name="nivo_slider_module[<?php echo $module_row; ?>][width]" value="<?php echo $module['width']; ?>" size="3" />
              <input type="text" name="nivo_slider_module[<?php echo $module_row; ?>][height]" value="<?php echo $module['height']; ?>" size="3"/>
              <?php if (isset($error_dimension[$module_row])) { ?>
              <span class="error"><?php echo $error_dimension[$module_row]; ?></span>
              <?php } ?></td>
            <td class="left"><select name="nivo_slider_module[<?php echo $module_row; ?>][layout_id]">
                <?php foreach ($layouts as $layout) { ?>
                <?php if ($layout['layout_id'] == $module['layout_id']) { ?>
                <option value="<?php echo $layout['layout_id']; ?>" selected="selected"><?php echo $layout['name']; ?></option>
                <?php } else { ?>
                <option value="<?php echo $layout['layout_id']; ?>"><?php echo $layout['name']; ?></option>
                <?php } ?>
                <?php } ?>
              </select></td>
            <td class="left"><select name="nivo_slider_module[<?php echo $module_row; ?>][position]">
                <?php if ($module['position'] == 'content_top') { ?>
                <option value="content_top" selected="selected"><?php echo $text_content_top; ?></option>
                <?php } else { ?>
                <option value="content_top"><?php echo $text_content_top; ?></option>
                <?php } ?>
                <?php if ($module['position'] == 'content_bottom') { ?>
                <option value="content_bottom" selected="selected"><?php echo $text_content_bottom; ?></option>
                <?php } else { ?>
                <option value="content_bottom"><?php echo $text_content_bottom; ?></option>
                <?php } ?>
                <?php if ($module['position'] == 'column_left') { ?>
                <option value="column_left" selected="selected"><?php echo $text_column_left; ?></option>
                <?php } else { ?>
                <option value="column_left"><?php echo $text_column_left; ?></option>
                <?php } ?>
                <?php if ($module['position'] == 'column_right') { ?>
                <option value="column_right" selected="selected"><?php echo $text_column_right; ?></option>
                <?php } else { ?>
                <option value="column_right"><?php echo $text_column_right; ?></option>
                <?php } ?>
              </select></td>
            <td class="left"><select name="nivo_slider_module[<?php echo $module_row; ?>][status]">
                <?php if ($module['status']) { ?>
                <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                <option value="0"><?php echo $text_disabled; ?></option>
                <?php } else { ?>
                <option value="1"><?php echo $text_enabled; ?></option>
                <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                <?php } ?>
              </select></td>
            <td class="right"><input type="text" name="nivo_slider_module[<?php echo $module_row; ?>][sort_order]" value="<?php echo $module['sort_order']; ?>" size="3" /></td>
            <td class="left"><a onclick="$('#module-row<?php echo $module_row; ?>').remove();" class="button"><?php echo $button_remove; ?></a></td>
          </tr>
        </tbody>
        <?php $module_row++; ?>
        <?php } ?>
        <tfoot>
          <tr>
            <td colspan="6"></td>
            <td class="left"><a onclick="addModule();" class="button"><?php echo $button_add_module; ?></a></td>
          </tr>
        </tfoot>
      </table>
    </form>
  </div>
</div>
<script type="text/javascript"><!--
var module_row = <?php echo $module_row; ?>;

function addModule() {	
	html  = '<tbody id="module-row' + module_row + '">';
	html += '  <tr>';
	html += '    <td class="left"><select name="nivo_slider_module[' + module_row + '][banner_id]">';
	<?php foreach ($banners as $banner) { ?>
	html += '      <option value="<?php echo $banner['banner_id']; ?>"><?php echo addslashes($banner['name']); ?></option>';
	<?php } ?>
	html += '    </select></td>';
	html += '    <td class="left"><input type="text" name="nivo_slider_module[' + module_row + '][width]" value="" size="3" /> <input type="text" name="nivo_slider_module[' + module_row + '][height]" value="" size="3" /></td>';	
	html += '    <td class="left"><select name="nivo_slider_module[' + module_row + '][layout_id]">';
	<?php foreach ($layouts as $layout) { ?>
	html += '      <option value="<?php echo $layout['layout_id']; ?>"><?php echo addslashes($layout['name']); ?></option>';
	<?php } ?>
	html += '    </select></td>';
	html += '    <td class="left"><select name="nivo_slider_module[' + module_row + '][position]">';
	html += '      <option value="content_top"><?php echo $text_content_top; ?></option>';
	html += '      <option value="content_bottom"><?php echo $text_content_bottom; ?></option>';
	html += '      <option value="column_left"><?php echo $text_column_left; ?></option>';
	html += '      <option value="column_right"><?php echo $text_column_right; ?></option>';
	html += '    </select></td>';
	html += '    <td class="left"><select name="nivo_slider_module[' + module_row + '][status]">';
    html += '      <option value="1" selected="selected"><?php echo $text_enabled; ?></option>';
    html += '      <option value="0"><?php echo $text_disabled; ?></option>';
    html += '    </select></td>';
	html += '    <td class="right"><input type="text" name="nivo_slider_module[' + module_row + '][sort_order]" value="" size="3" /></td>';
	html += '    <td class="left"><a onclick="$(\'#module-row' + module_row + '\').remove();" class="button"><?php echo $button_remove; ?></a></td>';
	html += '  </tr>';
	html += '</tbody>';
	
	$('#module tfoot').before(html);
	
	module_row++;
}
//--></script>
<?php echo $footer; ?>